package leecode

func minCostClimbingStairs(cost []int) int {
	length := len(cost)         // 3
	dp := make([]int, length+1) //到达第i阶台阶花费的最小体力
	dp[0], dp[1] = 0, 0
	for i := 2; i <= length; i++ {
		dp[i] = min(dp[i-1]+cost[i-1], dp[i-2]+cost[i-2])
	}
	return dp[length]
}
